#include "IFuncLine.h"
#include "IOperator.h"
#include "IFunction.h"
#include "IFuncParam.h"
#include "IFuncNormal.h"
#include "IFuncPrint.h"
#include <iostream>
using namespace std;

int f1(int x, int param)
{
    x = (50*x)/(3*param);
    return x;
}

int f2(int x, int param)
{
    x = (10*x)/param;
    return x;
}

int f3(int x)
{
    x = x+1;
    return x;
}

int f4(int x)
{
    x = x/2;
    return x;
}

int main()
{
    IFuncLine funcLine1, funcLine2;
    IOperator *op1, *op2, *op3, *op4, *op5, *op6, *op7, *op8;

    /// Lista #1 ////////////////////////////////////////
    op1 = funcLine1.addFunction(new IFuncParam(f1,5));
    funcLine1.addPrint();
    op2 = funcLine1.addFunction(new IFuncParam(f2,0));
    funcLine1.addPrint();
    op3 = funcLine1.addFunction(new IFuncNormal(f3));
    op4 = funcLine1.addFunction(new IFuncNormal(f4));
    funcLine1.addPrint();
    /// /////////////////////////////////////////////////

    /// Lista #2 ////////////////////////////////////////
    op5 = funcLine2.addFunction(new IFuncParam(f2,5));
    funcLine2.addPrint();
    op6 = funcLine2.addFunction(new IFuncParam(f1,0));
    funcLine2.addPrint();
    op7 = funcLine2.addFunction(new IFuncNormal(f4));
    op8 = funcLine2.addFunction(new IFuncNormal(f3));
    funcLine2.addPrint();
    /// /////////////////////////////////////////////////

    cout<<"TESTE #1:"<<endl;
    cout<<"* funcLine1:"<<endl;
    funcLine1.runFuncLine(1);
    cout<<"* funcLine2:"<<endl;
    funcLine2.runFuncLine(1);

    op1->setParam(0);
    op2->setParam(4);
    op3->setFunction(new IFuncNormal(f4));
    op4->setFunction(new IFuncNormal(f3));


    op5->setParam(0);
    op6->setParam(20);
    op7->setFunction(new IFuncNormal(f3));
    op8->setFunction(new IFuncNormal(f4));

    cout<<"\nTESTE #2:"<<endl;
    cout<<"* funcLine1:"<<endl;
    funcLine1.runFuncLine(1);
    cout<<"* funcLine2:"<<endl;
    funcLine2.runFuncLine(1);

    return(0);
}
